package cn.bqjr.eily.samples.common.shiro;

import cn.bqjr.eily.samples.common.shiro.filter.VerifyCodeFilter;
import cn.bqjr.eily.shiro.spring.boot.IShiroFilterRegister;
import cn.bqjr.eily.shiro.spring.boot.entity.ShiroProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.servlet.Filter;
import java.util.Map;

@Component
public class ShiroUrlFilterRegister implements IShiroFilterRegister {

    @Autowired
    private ShiroProperties properties;

    @Override
    public void register(Map<String, Filter> filterMap) {
        filterMap.put("checkVerifyCode", new VerifyCodeFilter(
                properties.getBase().getVerifyCode().getValue(),
                properties.getBase().getVerifyCode().getId()));

    }
}
